package com.drojian.demo4;

import android.content.Intent;
import android.os.Bundle;

import androidx.fragment.app.Fragment;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.drojian.demo.R;
import com.drojian.demo4.internet.GsonJsonActivity;
import com.drojian.demo4.internet.JsonActivity;
import com.drojian.demo4.internet.OkHttpActivity;
import com.drojian.demo4.internet.SaxXMLActivity;
import com.drojian.demo4.internet.WebViewActivity;
import com.drojian.demo4.internet.httpUrlConnectionActivity;


public class InternetFragment extends Fragment {
    private View view;

    public static InternetFragment newInstance() {
        return new InternetFragment();
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        view = inflater.inflate(R.layout.part4_fragment_internet, container, false);
        View internet1 = view.findViewById(R.id.internet1);
        View internet2 = view.findViewById(R.id.internet2);
        View internet3 = view.findViewById(R.id.internet3);
        View internet4 = view.findViewById(R.id.internet4);
        View internet5 = view.findViewById(R.id.internet5);
        View internet6 = view.findViewById(R.id.internet6);
        internet1.setOnClickListener(v->startActivity(new Intent(getContext(), WebViewActivity.class)));
        internet2.setOnClickListener(v->startActivity(new Intent(getContext(), httpUrlConnectionActivity.class)));
        internet3.setOnClickListener(v->startActivity(new Intent(getContext(), OkHttpActivity.class)));
        internet4.setOnClickListener(v->startActivity(new Intent(getContext(), SaxXMLActivity.class)));
        internet5.setOnClickListener(v->startActivity(new Intent(getContext(), JsonActivity.class)));
        internet6.setOnClickListener(v->startActivity(new Intent(getContext(), GsonJsonActivity.class)));
        return view;
    }
}